
<!-- 页面每隔60s刷新一次 -->
<!-- <meta http-equiv="refresh" content="60"> -->
<nz-layout>
  <!-- 头 -->
  <nz-header class="header">
    <div class="logo">
      <span class="top">治具製作智能管理系統</span>
    </div>
    <div class="infom" style="line-height:21px;">
      <div class="time">
        <span class="ymd">{{today | date:'yyyy-MM-dd'}}</span>
        <span class="w"> {{week}}</span>
      </div>

      <div class="name">
        <span class="ch">{{name}}</span>
        <span class="en"> {{name_PY}}</span>
        <span class="id"> {{job_no}}</span>
      </div>
      <div class="department">
        <span class="number">{{department}}</span>
        <span class="as"> {{department_abb}}</span>
        <span class="role"> 賬戶角色：{{role}}</span>
        <a class="exit" type="button" (click)="(cancel())"> &nbsp;注销</a>
      </div>
    </div>
  </nz-header>
  <!-- 表格 -->
  <div class="table_content">
    <div class="bbs">
      <!-- 返回上一页 -->
      <button class="btn_back" (click)="back()"></button>
      <!-- 增加button -->
      <button class="btn_add" (click)="showinput()" *ngIf="wz!='jg'"></button>
      <div class="cncText">CNC設備工單</div>
    </div>
    <div class="Title" *ngIf="showInfom">
      機台：
      <nz-select nzShowSearch  nzPlaceHolder="Choose the type" [(ngModel)]="CNCname" style="width: 150px;"
        (ngModelChange)="show2()">
        <nz-option nzLabel="{{item}}" nzValue="{{item}}" *ngFor="let item of fdcnclist">
        </nz-option>
      </nz-select>
      <span>日期：
        <nz-date-picker [nzAllowClear]=false nzFormat="yyyy/MM/dd" [(ngModel)]="time" nzPlaceHolder="End"
          (ngModelChange)="EndChange($event)">
        </nz-date-picker>
      </span>
      <button nz-button nzTrigger="click" nz-dropdown [nzDropdownMenu]="menu4" id="banci">班別
        <i nz-icon nzType="down"></i>
      </button>

      <nz-dropdown-menu #menu4="nzDropdownMenu" class="drop">
        <ul nz-menu>
          <li nz-menu-item class="Li">
            <nz-radio-group [(ngModel)]="banBie">
              <label nz-radio [ngStyle]="style" nzValue="" (click)="allUnion()">All</label>
              <label nz-radio [ngStyle]="style" nzValue="白班" (click)="allUnion()">白班</label>
              <label nz-radio [ngStyle]="style" nzValue="晚班" (click)="allUnion()">晚班</label>
            </nz-radio-group>
          </li>
        </ul>
      </nz-dropdown-menu>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>配單人員：{{deliveryName}}</span>
    </div>
    <nz-table #groupingTable [nzData]="listOfDisplayData" nzSize="middle" [nzShowPagination]=false
      style="height: 550px; overflow: auto">
      <thead>
        <tr>
          <th style="min-width: 48px;" rowspan="2" nzLeft="0px"></th>
          <th style="min-width: 48px;" rowspan="2" nzLeft="48px"></th>
          <th style="min-width: 48px;" rowspan="2" nzLeft="96px"></th>
          <th style="min-width: 48px;" rowspan="2" nzLeft="144px"></th>
          <th style="min-width: 48px;" rowspan="2" nzLeft="192px"></th>
          <th style="min-width: 48px;" rowspan="2" nzLeft="240px"></th>
          <!-- <th style="min-width: 48px;" rowspan="2" nzLeft="96px"></th> -->
          <th style="min-width: 220px;" rowspan="2">
            <div class="biaot">工聯單號</div>
            <div class="jtou">
              <a (click)="sortUnionorderASC()" style="background:url(../../../assets/image/icon_up.svg);"></a>
              <a (click)="sortUnionorderDESC()" style="background: url(../../../assets/image/icon_down.svg);"></a>
            </div>
          </th>
          <th style="min-width: 230px;" rowspan="2">治具名稱</th>
          <th style="min-width: 60px;" rowspan="2">廠別</th>
          <th style="min-width: 240px;" rowspan="2">
            <div class="biaot">零件名稱</div>
            <div class="jtou">
              <a (click)="sortLjmcASC()" style="background:url(../../../assets/image/icon_up.svg);"></a>
              <a (click)="sortLjmcDESC()" style="background: url(../../../assets/image/icon_down.svg);"></a>
            </div>
          </th>
          <th style="min-width: 100px;" rowspan="2">
            <div class="warp">
              <div class="biaot">程序名稱</div>
              <div class="jtou">
                <a (click)="sortCxmcASC()" style="background:url(../../../assets/image/icon_up.svg);"></a>
                <a (click)="sortCxmcDESC()" style="background: url(../../../assets/image/icon_down.svg);"></a>
              </div>
            </div>
          </th>
          <th style="min-width: 100px;" rowspan="2">抬刀高度</th>
          <th style="min-width: 100px;" rowspan="2">預估時間</th>
          <!-- 料号 -->
          <th style="min-width: 185px;" rowspan="2">料號</th>
          <th style="min-width: 185px;" rowspan="2">材質</th>
          <th style="min-width: 155px;" rowspan="2">圖紙尺寸(X*Y*Z)mm</th>
          <th style="min-width: 80px;" rowspan="2">刀具需求</th>
          <th style="min-width: 200px;" rowspan="2">裝夾方式</th>
          <th style="min-width: 150px;" rowspan="2">加工原點</th>
          <th colspan="3">裝夾時間</th>
          <th style="min-width: 100px;" rowspan="2">
            <div class="warp">
              <div class="biaot">CNC機臺</div>
              <div class="jtou">
                <a (click)="sortCncASC()" style="background:url(../../../assets/image/icon_up.svg);"></a>
                <a (click)="sortCncDESC()" style="background: url(../../../assets/image/icon_down.svg);"></a>
              </div>
            </div>
          </th>
          <th style="min-width: 100px;" rowspan="2">CNC時間</th>
          <th style="min-width: 80px;" rowspan="2" nzCustomFilter>箱號
            <i nz-th-extra class="ant-table-filter-icon" nz-icon nz-dropdown #dropdown="nzDropdown" nzType="search"
              [nzDropdownMenu]="menu" nzTrigger="click" nzPlacement="bottom" [nzClickHide]="false" nzTableFilter></i>
          </th>
          <th colspan="5">下料尺寸單位mm</th>
          <th style="min-width: 70px;" rowspan="2">預計加工</th>
          <th style="min-width: 70px;" rowspan="2">工件數量</th>
          <th style="min-width: 70px;" rowspan="2">不良品數</th>
          <th style="min-width: 100px;" rowspan="2">編程人員</th>
          <th style="min-width: 200px;" rowspan="2">備註</th>
        </tr>
        <tr>
          <!-- <th style="min-width: 80px;">刀具確認</th>
          <th style="min-width: 80px;">機床清潔</th>
          <th style="min-width: 80px;">打PIN定位</th>
          <th style="min-width: 80px;">毛刺清潔</th>
          <th style="min-width: 130px;">程序異常處理時間</th> -->
          <th style="min-width: 80px;">單板夾裝</th>
          <th style="min-width: 80px;">裝夾板數</th>
          <th style="min-width: 80px;">裝夾縂工時</th>
          <th style="min-width: 60px;">X</th>
          <th style="min-width: 60px;">Y</th>
          <th style="min-width: 60px;">Z</th>
          <th style="min-width: 60px;">板數</th>
          <th style="min-width: 60px;">拼板</th>
        </tr>
      </thead>
      <tbody>
        <!-- 新增tr -->
        <tr class="tr_hover" id="addcnc" *ngIf="isShow">
          <!-- 确认按钮 -->
          <td nzLeft="0px" style="width: 48px; padding:5px 8px;"><button nz-button [nzType]="'primary'"
              class="confirmAdd" (click)="confirmAdd()"></button>
          </td>
          <!-- 取消按钮 -->
          <td nzLeft="48px" style="width: 48px; padding:5px 8px;"><button nz-button [nzType]="'primary'"
              class="cancelAdd" (click)="cancelAdd()"></button>
          </td>
          <td nzLeft="96px" style="width: 48px; padding:5px 8px;"></td>
          <td nzLeft="144px" style="width: 48px; padding:5px 8px;"></td>
          <td nzLeft="192px" style="width: 48px; padding:5px 8px;"></td>
          <td nzLeft="240px" style="width: 48px; padding:5px 8px;"></td>


          <td style="padding:5px 8px;width: 220px;"><input style="width: 220px;" [(ngModel)]="union_order" name=''
              readonly="true"></td>
          <td style="padding:5px 8px;width: 230px;"><input style="width: 230px;" [(ngModel)]="zjmc" name=''
              readonly="true"></td>
          <td style="padding:5px 8px;width: 60px;"><input style="width: 60px;" [(ngModel)]="factory" name=''
              readonly="true"></td>
          <td style="padding:5px 8px;width: 240px;"><input style="width: 240px;" [(ngModel)]="ljmc" name=''
              (ngModelChange)="pushCNC()"></td>
          <td style="padding:5px 8px;width: 100px;">
            <input style="width: 100px;" [(ngModel)]="cxmc" name='' *ngIf="wz == 'bc'">
            <input style="width: 100px;" [(ngModel)]="cxmc" name='' *ngIf="wz == 'jg'" readonly="true">
          </td>
          <td style="padding:5px 8px;width: 100px;">
            <input style="width: 100px;" [(ngModel)]="tdgd" name='' *ngIf="wz == 'bc'">
            <input style="width: 100px;" [(ngModel)]="tdgd" name='' *ngIf="wz == 'jg'" readonly="true">
          </td>
          <td style="padding:5px 8px;width: 100px;">
            <input style="width: 100px;" [(ngModel)]="ygsj" name='' *ngIf="wz == 'bc'">
            <input style="width: 100px;" [(ngModel)]="ygsj" name='' *ngIf="wz == 'jg'" readonly="true">
          </td>
          <td style="padding:5px 8px;width: 185px;"><input style="width: 185px;" [(ngModel)]="material_no" name=''
              readonly="true"></td>
          <td style="padding:5px 8px;width: 185px;"><input style="width: 185px;" [(ngModel)]="czhi" name=''
              readonly="true"></td>
          <td style="padding:5px 8px;width: 155px;"><input style="width: 155px;" [(ngModel)]="tzcc" name=''
              readonly="true"></td>
          <td style="padding:5px 8px;width: 80px;">
            <input style="width: 80px;" [(ngModel)]="djxq" name='' *ngIf="wz == 'bc'">
            <input style="width: 80px;" [(ngModel)]="djxq" name='' *ngIf="wz == 'jg'" readonly="true">
          </td>
          <!-- 裝夾方式 -->
          <td style="padding:5px 8px;width: 200px;">
            <nz-select style="width: 200px;" [(ngModel)]="zjfs" *ngIf="wz == 'bc'"
              (ngModelChange)="provinceChange1($event)">
              <nz-option *ngFor="let item of zjfsArr" [nzLabel]=item [nzValue]=item></nz-option>
            </nz-select>
            <nz-select style="width: 200px;" [(ngModel)]="zjfs" *ngIf="wz == 'jg'" nzDisabled>
              <nz-option *ngFor="let item of zjfsArr" [nzLabel]=item [nzValue]=item></nz-option>
            </nz-select>
          </td>
          <!-- 加工原點 -->
          <td style="padding:5px 8px;width: 100px;">
            <nz-select style="width: 130px;" [(ngModel)]="jgyd" *ngIf="wz == 'bc'">
              <nz-option *ngFor="let item of jgydArr" [nzLabel]=item [nzValue]=item></nz-option>
            </nz-select>
            <nz-select style="width: 130px;" [(ngModel)]="jgyd" *ngIf="wz == 'jg'" nzDisabled>
              <nz-option *ngFor="let item of jgydArr" [nzLabel]=item [nzValue]=item></nz-option>
            </nz-select>
          </td>
          <!-- <td style="padding:5px 8px;width: 80px;">
            <input style="width: 80px;" [(ngModel)]="djqr" name='' readonly="true">
          </td>
          <td style="padding:5px 8px;width: 80px;">
            <input style="width: 80px;" [(ngModel)]="jcqj" name='' readonly="true">
          </td>
          <td style="padding:5px 8px;width: 80px;">
            <input style="width: 80px;" [(ngModel)]="dpdw" name='' readonly="true">
          </td>
          <td style="padding:5px 8px;width: 80px;">
            <input style="width: 80px;" [(ngModel)]="mcqj" name='' readonly="true">
          </td>
          <td style="padding:5px 8px;width: 150px;">
            <input style="width: 150px;" [(ngModel)]="cxycclsj" name='' readonly="true">
          </td> -->
          <td style="padding:5px 8px;width: 80px;">
            <input style="width: 80px;" [(ngModel)]="dbjz" name='' readonly="true">
          </td>
          <td style="padding:5px 8px;width: 100px;">
            <input style="width: 100px;" [(ngModel)]="zjbs" name='' *ngIf="wz == 'jg'">
            <input style="width: 100px;" [(ngModel)]="zjbs" name='' *ngIf="wz == 'bc'" readonly="true">
          </td>
          <!-- 装夹总工时 -->
          <td style="padding:5px 8px;width: 100px;"><input style="width: 100px;" [(ngModel)]="zjzgs" name=''
              readonly="true"></td>
          <!--cnc机台-->
          <td style="padding:5px 8px;width: 100px;"><input style="width: 100px;" [(ngModel)]="cnc" name=''></td>
          <!--cnc时间-->
          <td style="padding:5px 8px;width: 80px;">
            <input style="width: 80px;" [(ngModel)]="cncsj" name='' *ngIf="wz == 'jg'">
            <input style="width: 80px;" [(ngModel)]="cncsj" name='' *ngIf="wz == 'bc'" readonly="true">
          </td>
          <!-- 箱号 -->
          <td style="padding:5px 8px;width: 80px;">
            <input style="width: 80px;" [(ngModel)]="box" name='' *ngIf="wz == 'jg'">
            <input style="width: 80px;" [(ngModel)]="box" name='' *ngIf="wz == 'bc'" readonly="true">
          </td>
          <td style="padding:5px 8px;width: 80px;">
            <input style="width: 80px;" [(ngModel)]="xlcc_x" name='' maxlength="5" *ngIf="wz == 'bc'">
            <input style="width: 80px;" [(ngModel)]="xlcc_x" name='' maxlength="5" *ngIf="wz == 'jg'" readonly="true">
          </td>
          <td style="padding:5px 8px;width: 80px;">
            <input style="width: 80px;" [(ngModel)]="xlcc_y" name='' maxlength="5" *ngIf="wz == 'bc'">
            <input style="width: 80px;" [(ngModel)]="xlcc_y" name='' maxlength="5" *ngIf="wz == 'jg'" readonly="true">
          </td>
          <td style="padding:5px 8px;width: 80px;">
            <input style="width: 80px;" [(ngModel)]="xlcc_z" name='' maxlength="5" *ngIf="wz == 'bc'">
            <input style="width: 80px;" [(ngModel)]="xlcc_z" name='' maxlength="5" *ngIf="wz == 'jg'" readonly="true">
          </td>
          <td style="padding:5px 8px;width: 130px;">
            <input style="width: 130px;" [(ngModel)]="xlcc_bs" name='' *ngIf="wz == 'bc'">
            <input style="width: 130px;" [(ngModel)]="xlcc_bs" name='' *ngIf="wz == 'jg'" readonly="true">
          </td>
          <td style="padding:5px 8px;width: 80px;" *ngIf="wz=='bc'">
            <!-- <input style="width: 80px;" [(ngModel)]="xlcc_pb" name=''> -->
            <label nz-checkbox [(ngModel)]="checked"></label>
          </td>
          <td style="padding:5px 8px;width: 80px;" *ngIf="wz=='jg'">
            <!-- <input style="width: 80px;" [(ngModel)]="xlcc_pb" name=''> -->
            <label nz-checkbox [(ngModel)]="checked" nzDisabled></label>
          </td>
          <td style="padding:5px 8px;width: 80px; ">
            <input style="width: 80px;" [(ngModel)]="yjjg" name='' *ngIf="wz == 'bc'">
            <input style="width: 80px;" [(ngModel)]="yjjg" name='' *ngIf="wz == 'jg'" readonly="true">
          </td>
          <td style="padding:5px 8px;width: 70px;"><input style="width: 70px;" [(ngModel)]="gjsl" name=''
              readonly="true"></td>
          <td style="padding:5px 8px;width: 70px;">
            <input style="width: 70px;" [(ngModel)]="blps" name='' *ngIf="wz == 'bc'">
            <input style="width: 70px;" [(ngModel)]="blps" name='' *ngIf="wz == 'jg'" readonly="true">
          </td>
          <td style="padding:5px 8px;width: 100px;">
            <input style="width: 100px;" [(ngModel)]="bcry" name='' *ngIf="wz == 'bc'">
            <input style="width: 100px;" [(ngModel)]="bcry" name='' *ngIf="wz == 'jg'" readonly="true">
          </td>
          <td style="padding:5px 8px;width: 200px;"><input style="width: 200px;" [(ngModel)]="bzhu" name=''></td>
        </tr>
        <tr *ngFor="let data of tablePageList,let key = index" class="tr_hover">
          <ng-container>
            <!-- 编辑按钮 -->
            <td nzLeft="0px" style="width: 48px; padding:5px 8px !important;">
              <div class="editable-row-operations">
                <ng-container *ngIf="!editCache[key].edit; else saveTpl">
                  <a (click)="startEdit(key,data)"><img src="../../../assets/image/icon_edit.svg"></a>
                </ng-container>
                <ng-template #saveTpl>
                  <a (click)="saveEdit(key)"><img src="../../../assets/image/icon_ok.svg"></a>
                </ng-template>
              </div>
            </td>
            <!-- 删除按钮 -->
            <td nzLeft="48px" style="width: 48px; padding:5px 8px !important;">
              <button nz-button [nzType]="'primary'" class="del" (click)="showModal(data)"
                *ngIf="!editCache[key].isdel"></button>
              <a *ngIf="editCache[key].edit" (click)="cancelEdit(key)"><img
                  src="../../../assets/image/icon_cancel.svg"></a>
            </td>
            <!-- 分单按钮 -->
            <td nzLeft="96px" style="width: 40px; padding:5px 8px !important;">
              <a class="chargeback" (click)="onegotwo(data)" *ngIf="wz=='jg'? false:data.rawdata!=0"
                style="width: 20px;height: 20px;">
                <!-- <img src="../../../assets/image/fd.svg" alt="分單"> -->
              </a>
            </td>
            <!-- 退回 -->
            <td nzLeft="144px" style="width: 48px; padding:5px 8px !important;">
              <a class="return" (click)="return(data)" title="退回"></a>
            </td>
            <!-- 送出 -->
            <td nzLeft="192px" style="width: 48px; padding:5px 8px !important;">
              <a class="send" (click)="send(data)" title="送出"></a>
            </td>
            <td nzLeft="240px" style="width: 48px; padding:5px 8px !important;">
              <a class="attich2" (click)="downLoad2(data)"></a>
            </td>

            <!-- union_order -->
            <td style="width: 220px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else union_orderInputTpl">
                <span style="color: red;" *ngIf="data.rawdata==1"> {{ data.union_order }}</span>
                <span *ngIf="data.rawdata!=1"> {{ data.union_order }}</span>
              </ng-container>
              <ng-template #union_orderInputTpl>
                <input readonly="true" style="width: 220px;color:#ffffff;" type="text" nz-input
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].union_order" />
              </ng-template>
            </td>
            <!-- name -->
            <td
              style="cursor:pointer;max-width: 250px;overflow: hidden; white-space: nowrap;text-overflow: ellipsis; padding:5px 15px !important;"
              title={{data.name}}>
              <ng-container *ngIf="!editCache[key].edit; else nameInputTpl">
                {{ data.name }}
              </ng-container>
              <ng-template #nameInputTpl>
                <input readonly="true" style="width: 230px;color:#ffffff;" type="text" nz-input
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].name" />
              </ng-template>
            </td>
            <!-- factory -->
            <td style="width: 60px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else factoryInputTpl">
                {{ data.factory }}
              </ng-container>
              <ng-template #factoryInputTpl>
                <input readonly="true" style="width: 60px;color:#ffffff;" type="text" nz-input
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].factory" />
              </ng-template>
            </td>
            <!-- ljmc -->
            <td style="width: 240px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else ljmcInputTpl">
                {{ data.ljmc }}
              </ng-container>
              <ng-template #ljmcInputTpl>
                <input readonly="true" style="width: 240px;color:#ffffff;" type="text" nz-input
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].ljmc" />
              </ng-template>
            </td>
            <!-- cxmc -->
            <td style="width: 100px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else cxmcInputTpl">
                {{ data.cxmc }}
              </ng-container>
              <ng-template #cxmcInputTpl>
                <input style="width: 100px;color:#ffffff;" type="text" nz-input readonly="true" *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].cxmc" />
                <input style="width: 100px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].cxmc" />
              </ng-template>
            </td>
            <!-- tdgd -->
            <td style="width: 100px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else tdgdInputTpl">
                {{ data.tdgd }}
              </ng-container>
              <ng-template #tdgdInputTpl>
                <input style="width: 100px;color:#ffffff;" type="text" nz-input readonly="true" *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].tdgd" />
                <input style="width: 100px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].tdgd" />
              </ng-template>
            </td>
            <!-- ygsj -->
            <td style="width: 100px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else ygsjInputTpl">
                {{ data.ygsj }}
              </ng-container>
              <ng-template #ygsjInputTpl>
                <input style="width: 100px;color:#ffffff;" type="text" nz-input readonly="true" *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].ygsj" />
                <input style="width: 100px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].ygsj" />
              </ng-template>
            </td>
            <!-- liaohao -->
            <td style="cursor:pointer;max-width: 200px;">
              <ng-container *ngIf="!editCache[key].edit; else liaohaoInputTpl">
                {{ data.material_no }}
              </ng-container>
              <ng-template #liaohaoInputTpl>
                <input readonly="true" style="width: 185px;color:#ffffff;" type="text" nz-input
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].material_no" />
              </ng-template>
            </td>
            <!-- czhi -->
            <td
              style="cursor:pointer;max-width: 200px;overflow: hidden; white-space: nowrap;text-overflow: ellipsis; padding:5px 15px !important;"
              title={{data.czhi}}>
              <ng-container *ngIf="!editCache[key].edit; else czhiInputTpl">
                {{ data.czhi }}
              </ng-container>
              <ng-template #czhiInputTpl>
                <input readonly="true" style="width: 185px;color:#ffffff;" type="text" nz-input
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].czhi" />
              </ng-template>
            </td>
            <!-- tzcc -->
            <td style="width: 155px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else tzccInputTpl">
                {{ data.tzcc }}
              </ng-container>
              <ng-template #tzccInputTpl>
                <input readonly="true" style="width: 155px;color:#ffffff;" type="text" nz-input
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].tzcc" />
              </ng-template>
            </td>
            <!-- djxq -->
            <td style="width: 80px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else djxqInputTpl">
                {{ data.djxq }}
              </ng-container>
              <ng-template #djxqInputTpl>
                <input style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true" *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].djxq" />
                <input style="width: 80px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].djxq" />
              </ng-template>
            </td>
            <!-- zjfs -->
            <td style="width: 200px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else zjfsInputTpl">
                {{ data.zjfs }}
              </ng-container>
              <ng-template #zjfsInputTpl>
                <nz-select style="width: 200px;"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].zjfs" nzDisabled
                  *ngIf="wz == 'jg'">
                  <nz-option *ngFor="let item of zjfsArr" [nzLabel]=item [nzValue]=item></nz-option>
                </nz-select>
                <nz-select style="width: 200px;"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].zjfs"
                  *ngIf="wz == 'bc'" (ngModelChange)="provinceChange($event,key)">
                  <nz-option *ngFor="let item of zjfsArr" [nzLabel]=item [nzValue]=item></nz-option>
                </nz-select>
              </ng-template>
            </td>
            <!-- jgyd -->
            <td style="width: 150px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else jgydInputTpl">
                {{ data.jgyd }}
              </ng-container>
              <ng-template #jgydInputTpl>
                <nz-select style="width: 130px;"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].jgyd" nzDisabled
                  *ngIf="wz == 'jg'">
                  <nz-option *ngFor="let item of jgydArr" [nzLabel]=item [nzValue]=item></nz-option>
                </nz-select>
                <nz-select style="width: 130px;"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].jgyd"
                  *ngIf="wz == 'bc'">
                  <nz-option *ngFor="let item of jgydArr" [nzLabel]=item [nzValue]=item></nz-option>
                </nz-select>
              </ng-template>
            </td>
            <!-- djqr -->
            <!-- <td style="width: 80px; padding:5px 15px !important;" id="djqr">
              <ng-container *ngIf="!editCache[key].edit; else djqrInputTpl">
                {{ data.djqr ==='' ? '' : data.djqr +'分鐘' }}
              </ng-container>
              <ng-template #djqrInputTpl>
                <input style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].djqr" />
              </ng-template>
            </td> -->
            <!-- jcqj -->
            <!-- <td style="width: 80px; padding:5px 15px !important;" id="jcqj">
              <ng-container *ngIf="!editCache[key].edit; else jcqjInputTpl">
                {{ data.jcqj ==='' ? '' : data.jcqj +'分鐘' }}
              </ng-container>
              <ng-template #jcqjInputTpl>
                <input style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].jcqj" />
              </ng-template>
            </td> -->
            <!-- dpdw -->
            <!-- <td style="width: 80px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else dpdwInputTpl">
                {{ data.dpdw ==='' ? '' : data.dpdw +'分鐘' }}
              </ng-container>
              <ng-template #dpdwInputTpl>
                <input style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].dpdw" />
              </ng-template>
            </td> -->
            <!-- mcqj -->
            <!-- <td style="width: 80px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else mcqjInputTpl">
                {{ data.mcqj ==='' ? '' : data.mcqj +'分鐘' }}
              </ng-container>
              <ng-template #mcqjInputTpl>
                <input style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].mcqj" />
              </ng-template>
            </td> -->
            <!-- cxycclsj -->
            <!-- <td style="width: 150px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else cxycclsjInputTpl">
                {{ data.cxycclsj ==='' ? '' : data.cxycclsj +'分鐘' }}
              </ng-container>
              <ng-template #cxycclsjInputTpl>
                <input style="width: 150px;color:#ffffff;" type="text" nz-input readonly="true"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].cxycclsj" />
              </ng-template>
            </td> -->
            <!-- dbjz -->
            <td style="width: 80px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else dbjzInputTpl" id="total">
                {{ data.dbjz ==='' ? '' : data.dbjz +'分鐘' }}
              </ng-container>
              <ng-template #dbjzInputTpl>
                <input style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].dbjz" />
              </ng-template>
            </td>
            <!-- zjbs -->
            <td style="width: 100px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else zjbsInputTpl">
                {{ data.zjbs }}
              </ng-container>
              <ng-template #zjbsInputTpl>
                <input style="width: 100px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].zjbs" />
                <input style="width: 100px;color:#ffffff;" type="text" nz-input readonly="true" *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].zjbs" />
              </ng-template>
            </td>
            <!-- 装夹总工时 zjzgs -->
            <td style="width: 100px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else zjzgsInputTpl">
                {{ data.zjzgs ==='' ? '' : data.zjzgs +'分鐘' }}
              </ng-container>
              <ng-template #zjzgsInputTpl>
                <input style="width: 100px;color:#ffffff;" type="text" nz-input readonly="true"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].zjzgs" />
              </ng-template>
            </td>


            <!-- <td style="width: 100px; padding:5px 15px !important;">{{ zjzgs[key] === 0 ? '' : zjzgs[key] +'分鐘' }} </td> -->
            <!-- cnc机台 -->
            <td style="width: 100px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else cncInputTpl">
                {{ data.cnc }}
              </ng-container>
              <ng-template #cncInputTpl>
                <input readonly="true" style="width: 100px;color:#ffffff;" type="text" nz-input
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].cnc" />
              </ng-template>
            </td>
            <!-- cnc时间 -->
            <td style="width: 80px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else cncsjInputTpl">
                {{ data.zjbs==''&&'0' ? '0':data.cncsj ==='' ? '' : data.cncsj +'分鐘' }}
              </ng-container>
              <ng-template #cncsjInputTpl>
                <input style="width: 80px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].cncsj" />
                <input style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true" *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].cncsj" />
              </ng-template>
            </td>
            <!-- box箱号 -->
            <td style="width: 80px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else boxInputTpl">
                {{ data.box ==='' ? '' : data.box +'號' }}
              </ng-container>
              <ng-template #boxInputTpl>
                <input style="width: 80px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].box" />
                <input style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true" *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].box" />
              </ng-template>
            </td>
            <!-- xlcc_x -->
            <td style="width: 80px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else xlcc_xInputTpl">
                {{ data.xlcc_x }}
              </ng-container>
              <ng-template #xlcc_xInputTpl>
                <input maxlength="5" style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true"
                  *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].xlcc_x" />
                <input maxlength="5" style="width: 80px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].xlcc_x" />
              </ng-template>
            </td>
            <!-- xlcc_y -->
            <td style="width: 80px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else xlcc_yInputTpl">
                {{ data.xlcc_y }}
              </ng-container>
              <ng-template #xlcc_yInputTpl>
                <input maxlength="5" style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true"
                  *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].xlcc_y" />
                <input maxlength="5" style="width: 80px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].xlcc_y" />
              </ng-template>
            </td>
            <!-- xlcc_z -->
            <td style="width: 80px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else xlcc_zInputTpl">
                {{ data.xlcc_z }}
              </ng-container>
              <ng-template #xlcc_zInputTpl>
                <input maxlength="5" style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true"
                  *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].xlcc_z" />
                <input maxlength="5" style="width: 80px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].xlcc_z" />
              </ng-template>
            </td>
            <!-- xlcc_bs -->
            <td style="width: 130px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else xlcc_bsInputTpl">
                {{ data.xlcc_bs }}
              </ng-container>
              <ng-template #xlcc_bsInputTpl>
                <input style="width: 130px;color:#ffffff;" type="text" nz-input nz-input readonly="true"
                  *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].xlcc_bs" />
                <input style="width: 130px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].xlcc_bs" />
              </ng-template>
            </td>
            <!-- xlcc_pb -->
            <td style="width: 80px; padding:5px 15px !important;" *ngIf="wz == 'bc'">
              <ng-container *ngIf="!editCache[key].edit; else xlcc_pbInputTpl">
                {{ data.xlcc_pb }}
              </ng-container>
              <ng-template #xlcc_pbInputTpl>
                <label nz-checkbox [(ngModel)]="checked"></label>
              </ng-template>
            </td>
            <td style="width: 80px; padding:5px 15px !important;" *ngIf="wz == 'jg'">
              <ng-container *ngIf="!editCache[key].edit; else jiagong">
                {{ data.xlcc_pb }}
              </ng-container>
              <ng-template #jiagong>
                <label nz-checkbox [(ngModel)]="checked" nzDisabled></label>
              </ng-template>
            </td>
            <!-- yjjg -->
            <td style="width: 80px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else yjjgInputTpl">
                {{ data.yjjg }}
              </ng-container>
              <ng-template #yjjgInputTpl>
                <input style="width: 80px;color:#ffffff;" type="text" nz-input readonly="true" *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].yjjg" />
                <input style="width: 80px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].yjjg" />
              </ng-template>
            </td>
            <!-- gjsl -->
            <td style="width: 70px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else gjslInputTpl">
                {{ data.gjsl }}
              </ng-container>
              <ng-template #gjslInputTpl>
                <input style="width: 70px;color:#ffffff;" type="text" nz-input readonly="true"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].gjsl" />
              </ng-template>
            </td>
            <!-- blps -->
            <td style="width: 70px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else blpsInputTpl">
                {{ data.blps }}
              </ng-container>
              <ng-template #blpsInputTpl>
                <input style="width: 70px;color:#ffffff;" type="text" nz-input readonly="true" *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].blps" />
                <input style="width: 70px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].blps" />
              </ng-template>
            </td>
            <!-- bcry -->
            <td style="width: 100px; padding:5px 15px !important;">
              <ng-container *ngIf="!editCache[key].edit; else bcryInputTpl">
                {{ data.bcry }}
              </ng-container>
              <ng-template #bcryInputTpl>
                <input style="width: 100px;color:#ffffff;" type="text" nz-input readonly="true" *ngIf="wz == 'jg'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].bcry" />
                <input style="width: 100px;color:#ffffff;" type="text" nz-input *ngIf="wz == 'bc'"
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].bcry" />
              </ng-template>
            </td>
            <!-- bzhu -->
            <td
              style="max-width: 200px; padding:5px 15px !important; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;"
              title="{{ data.bzhu }}">
              <ng-container *ngIf="!editCache[key].edit; else bzhuInputTpl">
                {{ data.bzhu }}
              </ng-container>
              <ng-template #bzhuInputTpl>
                <input style="width: 200px;color:#ffffff;" type="text" nz-input
                  [(ngModel)]="editCache[key+(curPage-1)*pageSize].data[key+(curPage-1)*pageSize].bzhu" />
              </ng-template>
            </td>
          </ng-container>
        </tr>
      </tbody>
    </nz-table>
    <!-- 筛选箱号 -->
    <nz-dropdown-menu #menu="nzDropdownMenu">
      <div class="search-box" style="background:#487377; margin-top: -18px;">
        <input type="text" nz-input placeholder="come on 箱号" [(ngModel)]="searchValue" />
        <button nz-button nzSize="small" nzType="primary" (click)="search()" class="search-button">
          Search
        </button>
        <button nz-button nzSize="small" (click)="reset()" class="search-button">Reset</button>
      </div>
    </nz-dropdown-menu>
    <!--分页-->
    <div class="page">
      <button type="button" [disabled]="!preShow" (click)="showPrePage()">上一頁</button>
      <input type="text" (change)="onChangePage($event.target.value)" placeholder="{{curPage}}" value="{{curPage}}">
      <span> / {{pageNo}} 頁</span>
      <button type="button" [disabled]="!nextShow" (click)="showNextPage()">下一頁</button>
    </div>
    <!-- 删除弹出框-->
    <nz-modal [(nzVisible)]="isVisible" nzTitle="刪除" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()"
      [nzMaskStyle]="{backgroundColor:'rbga(48,73,77,.05)'}"
      [nzBodyStyle]="{height:'200px',background:'rgba(31,46,49,1)',color:'#ffffff',fontSize:'20px',fontWight:'300',textAlign:'center',lineHeight:'200px'}">
      <p>確定刪除嗎？</p>
    </nz-modal>
    <nz-modal [(nzVisible)]="isVisible2" nzTitle="分單" (nzOnCancel)="handleCancel2()" (nzOnOk)="handleOk2()"
      [nzMaskStyle]="{backgroundColor:'rbga(48,73,77,.05)'}"
      [nzBodyStyle]="{height:'200px',background:'rgba(31,46,49,1)',color:'#ffffff',fontSize:'20px',fontWight:'200',textAlign:'center'}">
      <div class="fdwarp">
        <button nz-button nzTrigger="click" nz-dropdown [nzDropdownMenu]="fdmenu" id="banci">機臺
          <i nz-icon nzType="down"></i>
        </button>
        <nz-dropdown-menu #fdmenu="nzDropdownMenu" class="drop">
          <ul nz-menu>
            <li nz-menu-item class="Li">
              <nz-radio-group [(ngModel)]="fdcnc">
                <label nz-radio [ngStyle]="style" nzValue="">空</label>
                <label nz-radio [ngStyle]="style" nzValue={{cnclist}}
                  *ngFor="let cnclist of fdcnclist">{{cnclist}}</label>
              </nz-radio-group>
            </li>
          </ul>
        </nz-dropdown-menu><br>
        數量&nbsp; : &nbsp;<input type="number" [(ngModel)]="fdnumber" class="NGnum" min=0>
        <!-- <br>
        箱號&nbsp; : &nbsp;<input type="text" [(ngModel)]="fdbox" class="NGnum"> -->

        <!-- <div style="background: #ffffff;">1</div>
        <div style="background: #000;">2</div>
        <div style="background: yellow;">3</div> -->
      </div>
    </nz-modal>
    <!-- 文件退回 -->
    <nz-modal class="remark" [(nzVisible)]="addOtherRemark" nzTitle="退回" (nzOnCancel)="CancelRemark()"
      (nzOnOk)="RemarkOk()" [nzOkLoading]="isOkLoadingOthRemark" style="text-align:center" nzWidth='600px'
      [nzMaskStyle]="{backgroundColor:'rbga(48,73,77,.05)'}"
      [nzBodyStyle]="{background:'rgba(31,46,49,1)',color:'#ffffff',fontSize:'20px',textAlign:'center',lineHeight:'20px'}">
      <!-- <div style="margin-top:0px" *ngIf="wz == 'jg'"> -->
      <!-- <textarea nz-input [(ngModel)]="RemarkValue" [nzAutosize]="{ minRows: 8, maxRows: 8 }"
          class="deRemark"></textarea>
      </div>
      <div *ngIf="wz == 'bc'" style="text-align: center;line-height: 300px;">
        退回此工件會將該工單下所有數據清空！
      </div> -->
      <textarea nz-input [(ngModel)]="RemarkValue" [nzAutosize]="{ minRows: 8, maxRows: 8 }"
        class="deRemark"></textarea>
    </nz-modal>

    <nz-modal [(nzVisible)]="fileInfom2" nzTitle="文件信息" (nzOnCancel)="CancelShow2()" (nzOnOk)="ShowOK2()"
      [nzOkLoading]="isOkLoadingfileInfom" style="text-align:center" nzWidth='1000px'
      [nzBodyStyle]="{height:'600px',background:'rgba(31,46,49,1)',color:'#ffffff',fontSize:'18px',textAlign:'center',lineHeight:'20px'}">
      <ul>
        <li *ngFor="let item of imglist" style="height: 20px;padding: 10px;"> <a [href]=link+item
            [download]=item>{{item}}
          </a></li>
      </ul>
    </nz-modal>
    <!-- 送出 -->
    <nz-modal [(nzVisible)]="isSendVisible" nzTitle="送出" (nzOnCancel)="handleSendCancel()" (nzOnOk)="sendOk()"
      [nzOkLoading]="isSendOkLoading" [nzMaskStyle]="{backgroundColor:'rbga(48,73,77,.05)'}"
      [nzBodyStyle]="{height:'200px',background:'rgba(31,46,49,1)',color:'#ffffff',fontSize:'20px',fontWight:'300',textAlign:'center',lineHeight:'200px'}">
      <p>確認送出這個工件嗎？</p>
    </nz-modal>
  </div>
</nz-layout>